package com.smcaiot.jftorg.south.adapter;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.smcaiot.jftorg.domain.org.OrgId;
import com.smcaiot.jftorg.domain.user.User;
import com.smcaiot.jftorg.south.convert.JftUserConvert;
import com.smcaiot.jftorg.south.entity.JftUser;
import com.smcaiot.jftorg.south.mapper.JftUserMapper;
import com.smcaiot.jftorg.south.port.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: cz
 * @Date: 2023/9/26
 * @Description:
 */
@Component
public class UserRepositoryAdapter extends ServiceImpl<JftUserMapper, JftUser> implements UserRepository {
    @Autowired
    private JftUserMapper userMapper;

    @Override
    public User getUser(OrgId userId) {
        JftUser user = userMapper.getUser(userId.value());
        return JftUserConvert.INSTANCE.to(user);
    }
}
